Session 02:
Ch 2 (Installation) &
Ch 3 (Connect Git, GitHub, RStudio)

Book club: Happy Git and GitHub for the useR
R-Ladies Bergen, R-Ladies Den Bosch, R-Ladies Amsterdam

Program for today

  • Presentation of Chapter 2 (Installation) &
  • Presentation of Chapter 3 (Connect Git, GitHub, RStudio)

House rules for R-Ladies arrangements

  • R-Ladies is dedicated to providing a harassment-free experience for everyone
  • We do not tolerate harassment of participants in any form
  • See the code of conduct.

A good start is a great beginning!

Alt text

Chapter 2: Installation

  • Register a free GitHub account
    • Can have unlimited number of private repos (up to 3 collaborators)
  • Install or upgrade R and RStudio
    • Install/Update R
    • Install RStudio (Posit)
    • Update your R packages:
      • update.packages(ask = FALSE, checkBuilt = TRUE)
    • Update:
      • R 1-2 times/year
      • RStudio (Posit) every month

Chapter 2: Installation

  • Install Git
    • Windows 1: Git for Windows (Git Bash) / 2: via Chocolatey
      • Update git update-git-for-windows
    • macOS 1: Xcode command line tools / 2: via this link / 3: through Homebrew (missing package manager for OS X)
    • Linux

Chapter 2: Installation

  • Introduce yourself to Git Making yourself identifiable
    • 1: Shell git config
      • git config --global user.name "Jane Doe"
      • git config --global user.email "jane@example.com"
      • git config --global --list
    • 2: RStudio (Posit) «usethis»-package
      • use_git_config(user.name = "Jane Doe", user.email = "jane@example.org")
    • Check: git config –global --list
    • Configure the Editor git config –global core.editor
    • Configure the default name for an initial branch (e.g., “main”)
      • 1: Shell git config --global init.defaultBranch main
      • 2: R usethis::git_default_branch_configure()

Chapter 2: Installation

Chapter 3: Connect Git, GitHub, RStudio

  • Credential setup To be identified as a specific GitHub user
    • Git’s communication with a remote server 2 protocols
    • 1: Personal access token (PAT) for HTTPS
      • 1: Through this link -> «Generate token» (Select «repo», «user», «workflow»)
      • 2: R console usethis::create_github_token()
        • Can store the PAT in R gitcreds::gitcreds_set()
        • Paste the PAT
    • 2: Set up keys for SSH More secure
      • Create a public-private SSH key pair -> Add the private key to your ssh-agent -> Add your public key to your GitHub profile
      • SSH should be swapped around once a year

Chapter 3: Connect Git, GitHub, RStudio

  • Connect to GitHub
    • Make a repo on GitHub
    • Clone the repo to your local computer
    • Make a local change, commit, and push
    • Confirm the local change propagated to the GitHub remote
    • Clean up

  • Connect Rstudio to Git and GitHub

The end of the session 2!